package com.wxlsoft.config.deploy;

import com.wxlsoft.config.model.GenralConfigProperties;
import com.wxlsoft.excel.enums.HandlerConfigType;
import com.wxlsoft.utils.LogUtils;
import com.wxlsoft.utils.UIContext;

public class ConfigSourceAutoDeploy {
	
	private GenralConfigProperties configProperties;
	
	private EsbPlatform platform;
	
    public ConfigSourceAutoDeploy(GenralConfigProperties configProperties) {
		this.configProperties = configProperties;
		this.platform = new EsbPlatform(configProperties);
	}

	public void deploy() {
    	try {
    		HandlerConfigType configType = configProperties.getConfigType();
    		switch (configType) {
	    		case ESB_PLATFORM: esbDeploy();
	    			break;
	    		case SERVICE_PLATFORM:;
	    			break;
	    		default: break;
    		}
    	} catch (Exception e) {
    		LogUtils.error("Dcits >>>>>> config system push files error", e);
    		throw new RuntimeException(e);
    	}
    }

	private void esbDeploy() throws Exception {
		platform.publish();
	}

	public EsbPlatform getPlatform() {
		return platform;
	}

}
